package android.medicalcloud.com.yiapp.yilian.configer.xml;

import android.medicalcloud.com.yiapp.R;
import android.medicalcloud.com.yiapp.yilian.application.YilianAppcation;



/**
 * 从资源中获取的rul 的res
 */
public class UrlRes {


    boolean dev;

    public static UrlRes getInstance() {

        return SingleClearCach.instance;
    }

    public boolean isDev() {
        return dev;
    }

    public void setDev(boolean dev) {
        this.dev = dev;
    }


    public String getUrl() {
        if (dev) {
            return YilianAppcation.instance.getApplicationContext()
                    .getResources().getString(R.string.urlsOnDev)
                    +YilianAppcation.instance.getApplicationContext()
                    .getResources().getString(R.string.actionPre)+
                    YilianAppcation.instance.getApplicationContext()
                            .getResources().getString(R.string.interfaceVersion);
        }

        return YilianAppcation.instance.getApplicationContext()
                .getResources().getString(R.string.urlsOnLine)+
                YilianAppcation.instance.getApplicationContext()
                .getResources().getString(R.string.actionPre)+
                YilianAppcation.instance.getApplicationContext()
                        .getResources().getString(R.string.interfaceVersion);
    }

    public String getImageUrl() {
        if (dev) {
            return YilianAppcation.instance.getApplicationContext().getResources().getString(R.string.imageUrlsOnDev);
        }

        return YilianAppcation.instance.getApplicationContext().getResources().getString(R.string.imageUrlsOnLine);
    }


    static class SingleClearCach {
        static UrlRes instance = new UrlRes();
    }
}
